package com.sskj.hhrt.mine;

import com.sskj.hhrt.BasePresenter;
import com.sskj.base.utils.MD5Utils;
import com.sskj.base.utils.RxUtils;
import com.sskj.hhrt.api.Api;
import com.sskj.hhrt.api.ApiObserver;


/**
 * @author Hey
 * Create at  2019/03/20
 */
class ResetLoginPasswordPresenter extends BasePresenter<ResetLoginPasswordActivity> {


    public void sendCode(String account) {
        Api.getInstance().getCode("9", account)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<String>(this, true) {
                    @Override
                    public void onSuccess(String data) {
                        mView.sendCodeSuccess();
                    }
                });
    }

    public void resetPassword(String account, String ps, String ps2, String code) {
        Api.getInstance().updatePwd(account, code, ps, ps2)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<String>(this, true) {
                    @Override
                    public void onSuccess(String data) {
                        mView.resetPasswordSuccess();
                    }
                });
    }
}
